var Dept = new Vue({

    el : '#Deptlist',
    data :{

        deptname : '',
        jigoumingchengma:'',
        DeptList:[],
        DeptOne:{},

    },
    created : function() {
        this.selectJigoumaAndDepName();
    },
    methods : {

        selectJigoumaAndDepName: function() {
            var _this = this;
            // 单位名称
            $.post("../renyuan/findjigoumaanddeptname", {
                deptname: _this.deptname,
                jigoumingchengma:_this.jigoumingchengma,
                rdm : Math.random()
            }, function (ppData) {
                if (ppData != null) {
                    if (ppData.result == '1') {
                        var data = ppData.resultContent;
                        _this.DeptList = data;

                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },

        Modify: function(ppDeptOne){
            var _this = this;
            _this.DeptOne = ppDeptOne;

            layer.open({type:3});
            $.post("../renyuan/modifydept",{
                olddeptname : _this.DeptOne.olddeptname,
                oldjigoumingchengma: _this.DeptOne.oldjigouma,
                deptname : _this.DeptOne.deptname,
                jigoumingchengma : _this.DeptOne.jigoumingchengma,
                rdm : Math.random()
            },function(ppData){
                layer.closeAll("loading");
                if (ppData != null){
                    if(ppData.result == "1"){

                        _this.selectJigoumaAndDepName;
                        layer.alert("保存成功");
                    }else{
                        layer.alert(ppData.message);
                    }
                }

            },"json");
        },


    },
    watch :{

    }

});
